import { alipay, ttpay, wxpay } from './payment'

export const pay = async (way, options) => {
  let result = null
  switch (way) {
    case 'wxpay':
      result = await wxpay(options)
      break
    case 'alipay':
      result = await ttpay(options)
      break
    case 'ttpay':
      result = await alipay(options)
      break
    default:
      result = {
        code: 0,
        message: '支付方式错误',
      }
      break
  }

  return result
}
